package com.zsj.springbootmq.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.support.converter.Jackson2JsonMessageConverter;
import org.springframework.amqp.support.converter.MessageConverter;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author https://gitee.com/zhengshengjun
 * @date 2023/11/16.
 */
@Configuration
@Slf4j
public class JsonRabbitMqConverter {

    /**
     * 放入一个json序列化的格式转换器
     */
    @Bean
    public MessageConverter MessageConverter() {
        //使用这个json格式转换器需要加入 jackson的依赖 要不然会报错bean not create  class not found
        return new Jackson2JsonMessageConverter();
    }


}
